package sort.LeetCode;

public class Offer51_ {
   static int k=0;
    public static int reversePairs(int[] nums) {

        if(nums.length==0){
            return k;
        }
        shellSort(nums);
        return k;
    }

    public static void shellSort(int[] nums) {
        for (int i = 1; i < nums.length; i++) {
            for (int j = i; j - i >= 0 &&j< nums.length; j++) {
                if(nums[j]<nums[j-i]){
                    k++;
                }
            }
        }
    }

    public static void main(String[] args) {
        int[] nums={4,5,6,7};
        int k=reversePairs(nums);
        System.out.println(k);
    }

}

